<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>项目评审 - 线评测系统</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            background-color: #f5f7fa;
            color: #333;
        }

        /* 主要内容样式 */
        .main-content {
            padding: 20px;
            width: 100%;
            max-width: 1200px;
            margin: 0 auto;
        }

        .page-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            padding-bottom: 15px;
            border-bottom: 1px solid #e8e8e8;
        }

        .page-title {
            font-size: 20px;
            font-weight: 500;
            color: #333;
        }

        .btn-group {
            display: flex;
            gap: 10px;
        }

        .btn {
            padding: 8px 16px;
            border-radius: 4px;
            font-size: 14px;
            cursor: pointer;
            border: none;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            gap: 5px;
        }

        .btn-primary {
            background-color: #1890ff;
            color: #fff;
        }

        .btn-primary:hover {
            background-color: #40a9ff;
        }

        .btn-default {
            background-color: #f5f5f5;
            color: #333;
            border: 1px solid #d9d9d9;
        }

        .btn-default:hover {
            background-color: #e8e8e8;
        }

        .btn-success {
            background-color: #52c41a;
            color: #fff;
        }

        .btn-success:hover {
            background-color: #73d13d;
        }

        .btn-danger {
            background-color: #f5222d;
            color: #fff;
        }

        .btn-danger:hover {
            background-color: #ff4d4f;
        }

        .btn-disabled {
            background-color: #f5f5f5;
            color: #bfbfbf;
            cursor: not-allowed;
        }

        /* 项目列表样式 */
        .project-list-container {
            background-color: #fff;
            border-radius: 4px;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
            padding: 20px;
            margin-bottom: 20px;
        }

        .list-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .search-box {
            display: flex;
            align-items: center;
            padding: 8px 12px;
            border: 1px solid #d9d9d9;
            border-radius: 4px;
            width: 300px;
        }

        .search-box input {
            border: none;
            outline: none;
            flex: 1;
            padding: 0 8px;
            font-size: 14px;
        }

        .search-box .search-icon {
            color: #999;
            margin-right: 5px;
        }

        .filter-btns {
            display: flex;
            gap: 10px;
        }

        .filter-btn {
            padding: 6px 12px;
            background: #f5f5f5;
            border: 1px solid #d9d9d9;
            border-radius: 4px;
            cursor: pointer;
            font-size: 14px;
            color: #333;
        }

        .filter-btn.active {
            background: #e6f7ff;
            border-color: #91d5ff;
            color: #1890ff;
        }

        .project-table {
            width: 100%;
            border-collapse: collapse;
        }

        .project-table th,
        .project-table td {
            padding: 12px 16px;
            text-align: left;
            border-bottom: 1px solid #f0f0f0;
        }

        .project-table th {
            background-color: #fafafa;
            font-weight: 500;
            color: #666;
            font-size: 14px;
        }

        .project-table tr:hover {
            background-color: #fafafa;
        }

        .project-table tr.selected {
            background-color: #e6f7ff;
        }

        .status-badge {
            display: inline-block;
            padding: 4px 8px;
            border-radius: 12px;
            font-size: 12px;
        }

        .status-badge.success {
            background-color: #e6fff2;
            color: #52c41a;
        }

        .status-badge.warning {
            background-color: #fff7e6;
            color: #faad14;
        }

        .status-badge.info {
            background-color: #e6f7ff;
            color: #1890ff;
        }

        .status-badge.danger {
            background-color: #fff1f0;
            color: #f5222d;
        }

        /* 表单样式 */
        .form-container {
            background-color: #fff;
            border-radius: 4px;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
            padding: 25px;
            margin-bottom: 20px;
        }

        .form-header {
            padding-bottom: 15px;
            margin-bottom: 20px;
            border-bottom: 1px solid #e8e8e8;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .form-title {
            font-size: 18px;
            font-weight: 500;
            color: #333;
        }

        .form-table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 20px;
            table-layout: fixed;
        }

        .form-table th,
        .form-table td {
            border: 1px solid #e8e8e8;
            padding: 12px 15px;
            text-align: left;
            vertical-align: top;
        }

        .form-table th {
            width: 20%;
            background-color: #f9f9f9;
            font-weight: normal;
            color: #333;
        }

        .form-actions {
            display: flex;
            justify-content: center;
            margin-top: 30px;
            gap: 15px;
        }

        .form-actions .btn {
            min-width: 100px;
        }

        /* 评审表单样式 */
        .review-form {
            margin-top: 20px;
        }

        .review-section {
            margin-bottom: 20px;
        }

        .review-section-title {
            font-size: 16px;
            font-weight: 500;
            margin-bottom: 10px;
            color: #333;
        }

        .review-comments {
            width: 100%;
            min-height: 120px;
            padding: 10px;
            border: 1px solid #d9d9d9;
            border-radius: 4px;
            resize: vertical;
            font-family: inherit;
            font-size: 14px;
        }

        .review-comments:focus {
            outline: none;
            border-color: #40a9ff;
            box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
        }

        .score-input {
            width: 60px;
            padding: 5px;
            text-align: center;
            border: 1px solid #d9d9d9;
            border-radius: 4px;
        }

        .score-input:focus {
            outline: none;
            border-color: #40a9ff;
            box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
        }

        .score-row {
            display: flex;
            align-items: center;
            margin-bottom: 10px;
        }

        .score-label {
            flex: 1;
            font-size: 14px;
        }

        .score-value {
            width: 80px;
            text-align: center;
        }

        /* 控制显示/隐藏 */
        .hidden {
            display: none;
        }

        /* 附件列表 */
        .file-list {
            margin-top: 15px;
            list-style: none;
        }

        .file-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px 0;
            border-bottom: 1px solid #f0f0f0;
        }

        .file-name {
            display: flex;
            align-items: center;
            gap: 8px;
            color: #333;
        }

        .file-icon {
            color: #1890ff;
        }

        .file-actions {
            display: flex;
            gap: 10px;
        }

        .file-actions button {
            background: none;
            border: none;
            cursor: pointer;
            color: #8c8c8c;
            font-size: 14px;
        }

        .file-actions button:hover {
            color: #1890ff;
        }

        /* 响应式样式 */
        @media (max-width: 768px) {
            .form-table th {
                width: 30%;
            }
        }

        /* 模态框样式 */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: rgba(0, 0, 0, 0.5);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 1000;
            visibility: hidden;
            opacity: 0;
            transition: visibility 0s linear 0.25s, opacity 0.25s 0s;
        }

        .modal-overlay.active {
            visibility: visible;
            opacity: 1;
            transition-delay: 0s;
        }

        .modal-content {
            background-color: white;
            border-radius: 4px;
            width: 500px;
            max-width: 90%;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
        }

        .modal-header {
            padding: 15px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid #e8e8e8;
        }

        .modal-title {
            font-size: 16px;
            font-weight: 500;
            color: #333;
        }

        .modal-close {
            background: none;
            border: none;
            font-size: 20px;
            cursor: pointer;
            color: #999;
        }

        .modal-close:hover {
            color: #333;
        }

        .modal-body {
            padding: 20px;
        }

        .modal-footer {
            padding: 15px 20px;
            border-top: 1px solid #e8e8e8;
            display: flex;
            justify-content: flex-end;
            gap: 10px;
        }

        .reviewer-list {
            max-height: 200px;
            overflow-y: auto;
            margin-top: 15px;
            border: 1px solid #e8e8e8;
            border-radius: 4px;
        }

        .reviewer-item {
            padding: 10px 15px;
            display: flex;
            align-items: center;
            border-bottom: 1px solid #f0f0f0;
        }

        .reviewer-item:last-child {
            border-bottom: none;
        }

        .reviewer-checkbox {
            margin-right: 10px;
        }

        .project-status {
            margin-bottom: 15px;
            font-size: 14px;
            color: #666;
        }

        .reviewer-search {
            width: 100%;
            padding: 8px 12px;
            border: 1px solid #d9d9d9;
            border-radius: 4px;
            margin-bottom: 10px;
            font-size: 14px;
        }

        .reviewer-search:focus {
            outline: none;
            border-color: #40a9ff;
            box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
        }

        /* 新增审核按钮位置 */
        .button-top {
            margin-bottom: 15px;
            display: flex;
        }

        .button-top:nth-child(2) button {
            margin-left: 15px;
        }
    </style>
</head>

<body>
    <div class="main-content">
        <div class="page-header">
            <h1 class="page-title">项目评审</h1>
            <div class="btn-group">
                <button class="btn btn-default" id="refreshBtn">
                    <i class="fas fa-sync-alt"></i> 刷新
                </button>
                <button class="btn btn-default" id="printBtn">
                    <i class="fas fa-print"></i> 打印
                </button>
            </div>
        </div>

        <!-- 项目列表 (默认显示) -->
        <div class="project-list-container" id="projectListView">
            <div class="list-header">
                <div class="search-box">
                    <i class="fas fa-search search-icon"></i>
                    <input type="text" placeholder="项目名称/申报部门/申报人" />
                </div>
                <div class="filter-btns">
                    <button class="filter-btn active">全部</button>
                    <button class="filter-btn">待评审</button>
                    <button class="filter-btn">已评审</button>
                    <button class="filter-btn">已通过</button>
                    <button class="filter-btn">未通过</button>
                </div>
            </div>

            <!-- 添加新增评审人按钮 -->
            <div class="button-top">
                <button class="btn btn-primary" id="addReviewerBtn">
                    <i class="fas fa-plus"></i> 新增评审人
                </button>
                <button class="btn btn-primary" id="addBidEvaluatorBtn">
                    <i class="fas fa-user-plus"></i> 添加评标人
                </button>
                <button class="btn btn-disabled" id="submitReviewBtn" disabled>
                    <i class="fas fa-paper-plane"></i> 提交审核
                </button>
            </div>

            <table class="project-table">
                <thead>
                    <tr>
                        <th style="width: 50px;">NO.</th>
                        <th>项目名称</th>
                        <th>申报部门</th>
                        <th>申报人</th>
                        <th>申报日期</th>
                        <th>评审状态</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>1</td>
                        <td>医疗数据分析系统</td>
                        <td>信息化部</td>
                        <td>张三</td>
                        <td>2022-01-14</td>
                        <td><span class="status-badge success">已通过</span></td>
                        <td>
                            <button class="btn btn-default btn-sm view-btn" data-project-id="GZ0304001" data-project-amount="126.00" data-project-client="医院1院">查看</button>
                        </td>
                    </tr>
                    <tr>
                        <td>2</td>
                        <td>网络安全升级项目</td>
                        <td>信息化部</td>
                        <td>李四</td>
                        <td>2022-01-14</td>
                        <td><span class="status-badge danger">未通过</span></td>
                        <td>
                            <button class="btn btn-default btn-sm view-btn" data-project-id="GZ0304002" data-project-amount="95.50" data-project-client="信息中心">查看</button>
                        </td>
                    </tr>
                    <tr>
                        <td>3</td>
                        <td>移动办公应用开发</td>
                        <td>办公室</td>
                        <td>王五</td>
                        <td>2020-09-21</td>
                        <td><span class="status-badge info">待评审</span></td>
                        <td>
                            <button class="btn btn-primary btn-sm review-btn">评审</button>
                        </td>
                    </tr>
                    <tr>
                        <td>4</td>
                        <td>智能会议系统建设</td>
                        <td>信息化部</td>
                        <td>赵六</td>
                        <td>2024-02-26</td>
                        <td><span class="status-badge warning">评审中</span></td>
                        <td>
                            <button class="btn btn-primary btn-sm review-btn">继续评审</button>
                        </td>
                    </tr>
                    <tr>
                        <td>5</td>
                        <td>数据中心扩容</td>
                        <td>信息化部</td>
                        <td>钱七</td>
                        <td>2020-09-21</td>
                        <td><span class="status-badge info">待评审</span></td>
                        <td>
                            <button class="btn btn-primary btn-sm review-btn">评审</button>
                        </td>
                    </tr>
                </tbody>
            </table>

            <div style="display: flex; justify-content: flex-end; margin-top: 20px;">
                <div style="display: flex; gap: 10px; align-items: center;">
                    <button class="btn btn-default" style="padding: 5px 10px"><i
                            class="fas fa-angle-double-left"></i></button>
                    <button class="btn btn-default" style="padding: 5px 10px"><i class="fas fa-angle-left"></i></button>
                    <span>1 / 3</span>
                    <button class="btn btn-default" style="padding: 5px 10px"><i
                            class="fas fa-angle-right"></i></button>
                    <button class="btn btn-default" style="padding: 5px 10px"><i
                            class="fas fa-angle-double-right"></i></button>
                </div>
            </div>
        </div>
        <!-- 评审表单 (初始隐藏) -->
        <div id="reviewFormView" class="hidden">
            <div class="form-container">
                <div class="form-header">
                    <h2 class="form-title">项目评审 - <span id="projectNameTitle">移动办公应用开发</span></h2>
                    <div class="btn-group">
                        <button class="btn btn-default" id="previewBtn">
                            <i class="fas fa-eye"></i> 预览申报书
                        </button>
                        <button class="btn btn-default" id="downloadBtn">
                            <i class="fas fa-download"></i> 下载附件
                        </button>
                    </div>
                </div>

                <!-- 项目基本信息 -->
                <table class="form-table">
                    <tr>
                        <th>项目名称</th>
                        <td id="projectName">移动办公应用开发</td>
                        <th>申报部门</th>
                        <td id="department">办公室</td>
                    </tr>
                    <tr>
                        <th>申报人</th>
                        <td id="applicant">王五</td>
                        <th>申报日期</th>
                        <td id="applyDate">2020-09-21</td>
                    </tr>
                    <tr>
                        <th>项目类型</th>
                        <td id="projectType">软件类</td>
                        <th>预算金额</th>
                        <td id="budget">120.5万元</td>
                    </tr>
                    <tr>
                        <th>项目附件</th>
                        <td colspan="3">
                            <ul class="file-list">
                                <li class="file-item">
                                    <div class="file-name">
                                        <i class="fas fa-file-word file-icon"></i> 项目申报书.docx
                                    </div>
                                    <div class="file-actions">
                                        <button type="button" title="预览"><i class="fas fa-eye"></i></button>
                                        <button type="button" title="下载"><i class="fas fa-download"></i></button>
                                    </div>
                                </li>
                                <li class="file-item">
                                    <div class="file-name">
                                        <i class="fas fa-file-excel file-icon"></i> 项目预算表.xlsx
                                    </div>
                                    <div class="file-actions">
                                        <button type="button" title="预览"><i class="fas fa-eye"></i></button>
                                        <button type="button" title="下载"><i class="fas fa-download"></i></button>
                                    </div>
                                </li>
                                <li class="file-item">
                                    <div class="file-name">
                                        <i class="fas fa-file-pdf file-icon"></i> 技术方案.pdf
                                    </div>
                                    <div class="file-actions">
                                        <button type="button" title="预览"><i class="fas fa-eye"></i></button>
                                        <button type="button" title="下载"><i class="fas fa-download"></i></button>
                                    </div>
                                </li>
                            </ul>
                        </td>
                    </tr>
                </table>

                <!-- 评审表单 -->
                <form id="reviewForm" class="review-form">
                    <div class="review-section">
                        <h3 class="review-section-title">1. 项目必要性评分 (20分)</h3>
                        <div class="score-row">
                            <div class="score-label">项目建设必要性与紧迫性</div>
                            <div class="score-value">
                                <input type="number" class="score-input" name="necessity_score" min="0" max="20"
                                    value="0">
                            </div>
                        </div>
                        <textarea class="review-comments" name="necessity_comments" placeholder="请输入评审意见..."></textarea>
                    </div>

                    <div class="review-section">
                        <h3 class="review-section-title">2. 技术方案评分 (30分)</h3>
                        <div class="score-row">
                            <div class="score-label">技术路线的先进性、可行性</div>
                            <div class="score-value">
                                <input type="number" class="score-input" name="tech_score" min="0" max="30" value="0">
                            </div>
                        </div>
                        <textarea class="review-comments" name="tech_comments" placeholder="请输入评审意见..."></textarea>
                    </div>

                    <div class="review-section">
                        <h3 class="review-section-title">3. 预算合理性评分 (20分)</h3>
                        <div class="score-row">
                            <div class="score-label">预算编制的合理性、经济性</div>
                            <div class="score-value">
                                <input type="number" class="score-input" name="budget_score" min="0" max="20" value="0">
                            </div>
                        </div>
                        <textarea class="review-comments" name="budget_comments" placeholder="请输入评审意见..."></textarea>
                    </div>

                    <div class="review-section">
                        <h3 class="review-section-title">4. 实施方案评分 (20分)</h3>
                        <div class="score-row">
                            <div class="score-label">实施计划的可行性、完整性</div>
                            <div class="score-value">
                                <input type="number" class="score-input" name="implementation_score" min="0" max="20"
                                    value="0">
                            </div>
                        </div>
                        <textarea class="review-comments" name="implementation_comments"
                            placeholder="请输入评审意见..."></textarea>
                    </div>

                    <div class="review-section">
                        <h3 class="review-section-title">5. 预期效益评分 (10分)</h3>
                        <div class="score-row">
                            <div class="score-label">项目预期效益与影响</div>
                            <div class="score-value">
                                <input type="number" class="score-input" name="benefit_score" min="0" max="10"
                                    value="0">
                            </div>
                        </div>
                        <textarea class="review-comments" name="benefit_comments" placeholder="请输入评审意见..."></textarea>
                    </div>

                    <div class="review-section">
                        <h3 class="review-section-title">总评意见</h3>
                        <div class="score-row">
                            <div class="score-label">总分</div>
                            <div class="score-value">
                                <input type="number" class="score-input" id="total_score" name="total_score" readonly
                                    value="0">
                            </div>
                        </div>
                        <textarea class="review-comments" name="overall_comments" placeholder="请输入总评意见..."></textarea>
                    </div>

                    <div class="form-actions">
                        <button type="button" class="btn btn-default" id="cancelReviewBtn">
                            <i class="fas fa-times"></i> 取消
                        </button>
                        <button type="button" class="btn btn-default" id="saveReviewBtn">
                            <i class="fas fa-save"></i> 保存
                        </button>
                        <button type="button" class="btn btn-success" id="approveBtn">
                            <i class="fas fa-check"></i> 通过
                        </button>
                        <button type="button" class="btn btn-danger" id="rejectBtn">
                            <i class="fas fa-times"></i> 不通过
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <!-- 新增评审人模态框 -->
    <div class="modal-overlay" id="addReviewerModal">
        <div class="modal-content">
            <div class="modal-header">
                <h3 class="modal-title">新增评审人</h3>
                <button class="modal-close" id="closeReviewerModal">&times;</button>
            </div>
            <div class="modal-body">
                <div class="project-status">项目状态：待专家评审</div>
                <div>
                    <input type="text" class="reviewer-search" placeholder="评审人" id="reviewerSearch">
                    <div class="reviewer-list">
                        <div class="reviewer-item">
                            <input type="checkbox" class="reviewer-checkbox" id="reviewer1">
                            <label for="reviewer1">张三</label>
                        </div>
                        <div class="reviewer-item">
                            <input type="checkbox" class="reviewer-checkbox" id="reviewer2">
                            <label for="reviewer2">李四</label>
                        </div>
                        <div class="reviewer-item">
                            <input type="checkbox" class="reviewer-checkbox" id="reviewer3">
                            <label for="reviewer3">王五</label>
                        </div>
                        <div class="reviewer-item">
                            <input type="checkbox" class="reviewer-checkbox" id="reviewer4">
                            <label for="reviewer4">刘能</label>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button class="btn btn-default" id="cancelAddReviewer">取消</button>
                <button class="btn btn-primary" id="submitAddReviewer">提交</button>
            </div>
        </div>
    </div>

    <!-- 评审人签名模态框 -->
    <div class="modal-overlay" id="reviewerSignModal">
        <div class="modal-content">
            <div class="modal-header">
                <h3 class="modal-title">项目立项审核</h3>
                <button class="modal-close" id="closeSignModal">&times;</button>
            </div>
            <div class="modal-body">
                <div class="row mb-4">
                    <div class="col-md-12">
                        <table class="form-table" style="margin-bottom: 15px;">
                            <tr>
                                <th width="20%">项目名称</th>
                                <td width="30%" id="signProjectName"></td>
                                <th width="20%">项目编号</th>
                                <td width="30%" id="signProjectCode"></td>
                            </tr>
                            <tr>
                                <th>项目预算（万）</th>
                                <td id="signProjectBudget"></td>
                                <th>项目负责人</th>
                                <td id="signProjectLeader"></td>
                            </tr>
                        </table>
                    </div>
                </div>
                
                <div>
                    <h5>附件</h5>
                    <div style="display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px;">
                        <div style="border: 1px solid #e8e8e8; border-radius: 4px; padding: 10px; width: 200px;">
                            <div style="display: flex; align-items: center; margin-bottom: 5px;">
                                <i class="fas fa-file-pdf" style="color: #f5222d; margin-right: 5px;"></i>
                                <span style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">项目申报书.pdf</span>
                            </div>
                            <div style="display: flex; justify-content: space-between;">
                                <span style="color: #999; font-size: 12px;">124KB</span>
                                <div>
                                    <a href="#" style="margin-right: 8px;">在线预览</a>
                                    <a href="#">下载</a>
                                </div>
                            </div>
                        </div>
                        <div style="border: 1px solid #e8e8e8; border-radius: 4px; padding: 10px; width: 200px;">
                            <div style="display: flex; align-items: center; margin-bottom: 5px;">
                                <i class="fas fa-file-pdf" style="color: #f5222d; margin-right: 5px;"></i>
                                <span style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">项目预算表.pdf</span>
                            </div>
                            <div style="display: flex; justify-content: space-between;">
                                <span style="color: #999; font-size: 12px;">118KB</span>
                                <div>
                                    <a href="#" style="margin-right: 8px;">在线预览</a>
                                    <a href="#">下载</a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                
                <div style="margin-bottom: 20px;">
                    <div style="display: flex; justify-content: flex-end; align-items: center; margin-bottom: 10px;">
                        <label style="margin-right: 10px;">评审人签名：</label>
                        <div style="border: 1px solid #e8e8e8; width: 200px; height: 60px; display: flex; align-items: center; justify-content: center;">
                            <input type="text" id="reviewerSignature" style="border: none; width: 100%; height: 100%; text-align: center; font-size: 16px;" placeholder="请输入姓名">
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button class="btn btn-default" id="cancelSign">取消</button>
                <button class="btn btn-primary" id="confirmSign">确认提交</button>
            </div>
        </div>
    </div>

    <!-- 添加评标人模态框 -->
    <div class="modal-overlay" id="addBidEvaluatorModal">
        <div class="modal-content">
            <div class="modal-header">
                <h3 class="modal-title">添加评标人</h3>
                <button class="modal-close" id="closeBidEvaluatorModal">&times;</button>
            </div>
            <div class="modal-body">
                <div class="project-status">项目状态：待评标</div>
                <div>
                    <input type="text" class="reviewer-search" placeholder="评标人姓名搜索" id="bidEvaluatorSearch">
                    <div class="reviewer-list">
                        <div class="reviewer-item">
                            <input type="checkbox" class="reviewer-checkbox" id="bidEvaluator1">
                            <label for="bidEvaluator1">赵专家</label>
                        </div>
                        <div class="reviewer-item">
                            <input type="checkbox" class="reviewer-checkbox" id="bidEvaluator2">
                            <label for="bidEvaluator2">钱专家</label>
                        </div>
                        <div class="reviewer-item">
                            <input type="checkbox" class="reviewer-checkbox" id="bidEvaluator3">
                            <label for="bidEvaluator3">孙专家</label>
                        </div>
                        <div class="reviewer-item">
                            <input type="checkbox" class="reviewer-checkbox" id="bidEvaluator4">
                            <label for="bidEvaluator4">李专家</label>
                        </div>
                        <div class="reviewer-item">
                            <input type="checkbox" class="reviewer-checkbox" id="bidEvaluator5">
                            <label for="bidEvaluator5">周专家</label>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button class="btn btn-default" id="cancelAddBidEvaluator">取消</button>
                <button class="btn btn-primary" id="submitAddBidEvaluator">提交</button>
            </div>
        </div>
    </div>
</body>

</html>
<script>
    // 切换视图的函数
    function showReviewForm() {
        document.getElementById('projectListView').classList.add('hidden');
        document.getElementById('reviewFormView').classList.remove('hidden');
    }

    function showProjectList() {
        document.getElementById('reviewFormView').classList.add('hidden');
        document.getElementById('projectListView').classList.remove('hidden');
    }

    // 新增评审人模态框相关函数
    function showAddReviewerModal() {
        document.getElementById('addReviewerModal').classList.add('active');
    }

    function hideAddReviewerModal() {
        document.getElementById('addReviewerModal').classList.remove('active');
    }

    // 评审人签名模态框相关函数
    function showSignModal() {
        document.getElementById('reviewerSignModal').classList.add('active');
    }

    function hideSignModal() {
        document.getElementById('reviewerSignModal').classList.remove('active');
    }

    // 添加评标人模态框相关函数
    function showAddBidEvaluatorModal() {
        document.getElementById('addBidEvaluatorModal').classList.add('active');
    }

    function hideAddBidEvaluatorModal() {
        document.getElementById('addBidEvaluatorModal').classList.remove('active');
    }

    // 为新增评审人按钮添加点击事件
    document.getElementById('addReviewerBtn').addEventListener('click', showAddReviewerModal);

    // 为模态框关闭按钮添加点击事件
    document.getElementById('closeReviewerModal').addEventListener('click', hideAddReviewerModal);
    document.getElementById('cancelAddReviewer').addEventListener('click', hideAddReviewerModal);
    document.getElementById('closeSignModal').addEventListener('click', hideSignModal);
    document.getElementById('cancelSign').addEventListener('click', hideSignModal);
    document.getElementById('closeBidEvaluatorModal').addEventListener('click', hideAddBidEvaluatorModal);
    document.getElementById('cancelAddBidEvaluator').addEventListener('click', hideAddBidEvaluatorModal);

    // 提交新增评审人
    document.getElementById('submitAddReviewer').addEventListener('click', function () {
        // 获取选中的评审人
        const checkedReviewers = document.querySelectorAll('.reviewer-checkbox:checked');
        if (checkedReviewers.length === 0) {
            alert('请选择至少一名评审人');
            return;
        }

        // 这里可以添加提交到后端的代码

        alert('评审人添加成功');
        hideAddReviewerModal();
    });

    // 提交审核按钮点击事件
    document.getElementById('submitReviewBtn').addEventListener('click', function () {
        const selectedRow = document.querySelector('.project-table tbody tr.selected');
        if (selectedRow) {
            const projectName = selectedRow.cells[1].textContent;
            const department = selectedRow.cells[2].textContent;
            const applicant = selectedRow.cells[3].textContent;
            const applyDate = selectedRow.cells[4].textContent;
            
            // 填充签名模态框中的项目信息
            document.getElementById('signProjectName').textContent = projectName;
            document.getElementById('signProjectCode').textContent = generateProjectCode();
            document.getElementById('signProjectBudget').textContent = '126.00';
            document.getElementById('signProjectLeader').textContent = applicant;
            
            // 显示签名模态框
            showSignModal();
        }
    });
    
    // 确认提交签名
    document.getElementById('confirmSign').addEventListener('click', function() {
        const signature = document.getElementById('reviewerSignature').value.trim();
        if (!signature) {
            alert('请输入评审人签名');
            return;
        }
        
        const selectedRow = document.querySelector('.project-table tbody tr.selected');
        if (selectedRow) {
            const projectName = selectedRow.cells[1].textContent;
            const department = selectedRow.cells[2].textContent;
            const applicant = selectedRow.cells[3].textContent;
            const applyDate = selectedRow.cells[4].textContent;
            
            // 构建URL参数
            const params = new URLSearchParams();
            params.append('name', projectName);
            params.append('department', department);
            params.append('applicant', applicant);
            params.append('date', applyDate);
            params.append('status', '待审核');
            params.append('reviewer', signature);
            
            // 跳转到审批页面
            window.location.href = '../project/approval/Approval-Window.html?' + params.toString();
        }
    });
    
    // 生成项目编号
    function generateProjectCode() {
        const date = new Date();
        const year = date.getFullYear().toString();
        const month = (date.getMonth() + 1).toString().padStart(2, '0');
        const day = date.getDate().toString().padStart(2, '0');
        const random = Math.floor(Math.random() * 10000).toString().padStart(4, '0');
        return year + month + day + random;
    }

    // 评审人搜索功能
    document.getElementById('reviewerSearch').addEventListener('input', function () {
        const searchText = this.value.toLowerCase();
        const reviewerItems = document.querySelectorAll('.reviewer-item');

        reviewerItems.forEach(item => {
            const reviewerName = item.querySelector('label').textContent.toLowerCase();
            if (reviewerName.includes(searchText)) {
                item.style.display = '';
            } else {
                item.style.display = 'none';
            }
        });
    });

    // 为评审按钮添加点击事件
    const reviewButtons = document.querySelectorAll('.review-btn');
    reviewButtons.forEach(button => {
        button.addEventListener('click', function () {
            const row = this.closest('tr');
            const projectName = row.cells[1].textContent;
            document.getElementById('projectNameTitle').textContent = projectName;
            document.getElementById('projectName').textContent = projectName;
            document.getElementById('department').textContent = row.cells[2].textContent;
            document.getElementById('applicant').textContent = row.cells[3].textContent;
            document.getElementById('applyDate').textContent = row.cells[4].textContent;

            showReviewForm();
        });
    });

    // 为查看按钮添加点击事件
    const viewButtons = document.querySelectorAll('.view-btn');
    viewButtons.forEach(button => {
        button.addEventListener('click', function () {
            const row = this.closest('tr');
            const projectName = row.cells[1].textContent;
            const department = row.cells[2].textContent;
            const applicant = row.cells[3].textContent;
            const applyDate = row.cells[4].textContent;
            
            // 获取项目编号和金额（从按钮的data属性中）
            const projectId = this.getAttribute('data-project-id') || 'GZ' + Math.floor(Math.random() * 10000000).toString().padStart(7, '0');
            const projectAmount = this.getAttribute('data-project-amount') || '120.00';
            const projectClient = this.getAttribute('data-project-client') || department;
            
            // 构建URL参数
            const params = new URLSearchParams();
            params.append('name', projectName);
            params.append('id', projectId);
            params.append('amount', projectAmount);
            params.append('leader', applicant);
            params.append('client', projectClient);
            params.append('remark', '-');
            
            // 跳转到评审表单页面
            window.location.href = 'review-form.html?' + params.toString();
        });
    });

    // 为"取消"按钮添加点击事件
    document.getElementById('cancelReviewBtn').addEventListener('click', function () {
        if (confirm('确定要取消评审吗？未保存的内容将会丢失。')) {
            showProjectList();
        }
    });

    // 保存评审按钮功能
    document.getElementById('saveReviewBtn').addEventListener('click', function () {
        alert('评审意见已保存');
    });

    // 通过按钮功能
    document.getElementById('approveBtn').addEventListener('click', function () {
        if (confirm('确认通过该项目？')) {
            alert('项目已通过评审');
            showProjectList();
        }
    });

    // 不通过按钮功能
    document.getElementById('rejectBtn').addEventListener('click', function () {
        if (confirm('确认不通过该项目？')) {
            alert('项目未通过评审');
            showProjectList();
        }
    });

    // 自动计算总分
    const scoreInputs = document.querySelectorAll('.score-input:not([readonly])');
    scoreInputs.forEach(input => {
        input.addEventListener('input', calculateTotalScore);
    });

    function calculateTotalScore() {
        const necessityScore = parseInt(document.querySelector('input[name="necessity_score"]').value) || 0;
        const techScore = parseInt(document.querySelector('input[name="tech_score"]').value) || 0;
        const budgetScore = parseInt(document.querySelector('input[name="budget_score"]').value) || 0;
        const implementationScore = parseInt(document.querySelector('input[name="implementation_score"]').value) || 0;
        const benefitScore = parseInt(document.querySelector('input[name="benefit_score"]').value) || 0;

        const totalScore = necessityScore + techScore + budgetScore + implementationScore + benefitScore;
        document.getElementById('total_score').value = totalScore;
    }

    // 初始化计算总分
    calculateTotalScore();

    // 项目列表中的行选择功能
    const tableRows = document.querySelectorAll('.project-table tbody tr');
    tableRows.forEach(row => {
        row.addEventListener('click', function (event) {
            // 如果点击的是按钮，则不执行行选择
            if (event.target.closest('button')) return;

            tableRows.forEach(r => r.classList.remove('selected'));
            this.classList.add('selected');
            
            // 启用提交审核按钮
            const submitReviewBtn = document.getElementById('submitReviewBtn');
            submitReviewBtn.classList.remove('btn-disabled');
            submitReviewBtn.classList.add('btn-primary');
            submitReviewBtn.disabled = false;
        });
    });
    
    // 点击页面空白处取消选择
    document.addEventListener('click', function (event) {
        if (!event.target.closest('.project-table') && !event.target.closest('#submitReviewBtn')) {
            tableRows.forEach(r => r.classList.remove('selected'));
            
            // 禁用提交审核按钮
            const submitReviewBtn = document.getElementById('submitReviewBtn');
            submitReviewBtn.classList.add('btn-disabled');
            submitReviewBtn.classList.remove('btn-primary');
            submitReviewBtn.disabled = true;
        }
    });

    // 为添加评标人按钮添加点击事件
    document.getElementById('addBidEvaluatorBtn').addEventListener('click', function() {
        const selectedRow = document.querySelector('.project-table tbody tr.selected');
        if (!selectedRow) {
            alert('请先选择一个项目');
            return;
        }
        showAddBidEvaluatorModal();
    });

    // 评标人搜索功能
    document.getElementById('bidEvaluatorSearch').addEventListener('input', function () {
        const searchText = this.value.toLowerCase();
        const evaluatorItems = document.querySelectorAll('#addBidEvaluatorModal .reviewer-item');

        evaluatorItems.forEach(item => {
            const evaluatorName = item.querySelector('label').textContent.toLowerCase();
            if (evaluatorName.includes(searchText)) {
                item.style.display = '';
            } else {
                item.style.display = 'none';
            }
        });
    });

    // 提交添加评标人
    document.getElementById('submitAddBidEvaluator').addEventListener('click', function () {
        // 获取选中的评标人
        const checkedEvaluators = document.querySelectorAll('#addBidEvaluatorModal .reviewer-checkbox:checked');
        if (checkedEvaluators.length === 0) {
            alert('请选择至少一名评标人');
            return;
        }

        const selectedRow = document.querySelector('.project-table tbody tr.selected');
        if (selectedRow) {
            const projectName = selectedRow.cells[1].textContent;
            
            // 这里可以添加提交到后端的代码
            // 模拟数据存储，实际项目中应该发送到服务器
            const evaluators = Array.from(checkedEvaluators).map(checkbox => {
                return checkbox.nextElementSibling.textContent;
            });
            
            // 在本地存储中保存评标人信息
            const projectEvaluators = JSON.parse(localStorage.getItem('projectEvaluators') || '{}');
            projectEvaluators[projectName] = evaluators;
            localStorage.setItem('projectEvaluators', JSON.stringify(projectEvaluators));

            alert(`已成功为项目"${projectName}"添加${checkedEvaluators.length}名评标人`);
            hideAddBidEvaluatorModal();
        }
    });
</script>